package com.ysd.lis.controller.lab;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.lab.LabCriticalReport;
import com.ysd.lis.request.lab.*;
import com.ysd.lis.service.lab.LabCriticalReportService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 危急值上报 前端控制器
 * </p>
 *
 * @author wanghao
 * @since 2024-02-20
 */
@RestController
@RequestMapping("/lab/criticalReport")
public class LabCriticalReportController extends BaseController {

    @Autowired
    private LabCriticalReportService labCriticalReportService;

    @ApiOperation("批量新增")
    @PostMapping("/batchAddCriticalReportList")
    public Result batchAddCriticalReportList(@RequestBody List<LabCriticalReport> labCriticalReports) {
        return labCriticalReportService.batchAddCriticalReportList(labCriticalReports);
    }

    @ApiOperation("his修改危急值")
    @PostMapping("/hisUpdateCritical")
    public Result hisUpdateCritical(@RequestBody LabCriticalReport labCriticalReports) {
        return labCriticalReportService.hisUpdateCritical(labCriticalReports);
    }

    @ApiOperation("删除危急值上报信息")
    @GetMapping("/deleteCriticalReportInfo")
    public Result deleteCriticalReportInfo(LabCriticalReport labCriticalReport) {
        return labCriticalReportService.deleteCriticalReportInfo(labCriticalReport);
    }

    @ApiOperation("查询病区危急值处理意见及时间")
    @GetMapping("/getTreatedCriticalReport")
    public Result getTreatedCriticalReport(getTreatedCriticalReportParam input) {
        return labCriticalReportService.getTreatedCriticalReport(input);
    }


    @ApiOperation("获取危急值上报信息(普通检验)")
    @PostMapping("/findCriticalReportInfo")
    public Result findCriticalReportInfo(@RequestBody CriticalReportDto criticalReportDto) {
        return labCriticalReportService.findCriticalReportInfo(criticalReportDto);
    }

    @ApiOperation("获取危急值上报信息(微生物)")
    @PostMapping("/findBacCriticalReportInfo")
    public Result findBacCriticalReportInfo(@RequestBody CriticalReportDto criticalReportDto) {
        return labCriticalReportService.findBacCriticalReportInfo(criticalReportDto);
    }

    //危急值提醒程序
    @ApiOperation("获取危急值信息")
    @PostMapping("/findAlarmReportInfo")
    public List<AlarmReportVo> findAlarmReportInfo(@RequestBody AlarmReportDto alarmReportDto) {
        return labCriticalReportService.findAlarmReportInfo(alarmReportDto);
    }

    //危急值提醒程序
    @ApiOperation("处理危急值")
    @PostMapping("/handleAlarm")
    public String handleAlarm(@RequestBody AlarmChkDto dto) {
        return labCriticalReportService.handleAlarm(dto);
    }

    //危急值提醒程序
    @ApiOperation("获取结果信息")
    @PostMapping("/getResultInfo")
    public List<AlarmRptresultVo> getResultInfo(@RequestBody String id) {
        return labCriticalReportService.getResultInfo(id);
    }

    //危急值定时服务调用
    @ApiOperation("获取危急值信息")
    @PostMapping("/findAlarmInfo")
    public List<AlarmReportVo> findAlarmInfo(@RequestBody AlarmReportDto alarmReportDto) {
        return labCriticalReportService.findAlarmInfo(alarmReportDto);
    }

}
